package form;

import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field;

import javax.servlet.http.HttpServletRequest;

public class FullForm {

	public FullForm()
	{
		
	}
	
	public static ActionFrom full (String formpath,HttpServletRequest request) throws InstantiationException, IllegalAccessException
	{
		ActionFrom form = null;
		
		try {
			Class clazz = Class.forName(formpath);
			form = (ActionFrom)clazz.newInstance();
			Field[] field_ar = clazz.getDeclaredFields();
			for(Field f:field_ar)
			{
				f.setAccessible(true);
				f.set(form, request.getParameter(f.getName()));
				f.setAccessible(false);
			}
			
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return form;
	}
}
